package com.gupao.vip.Indicator;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

/**
 * Created by 17082655 on 2019/1/6.
 * 自定义健康端点
 */
@Component("my1")
public class MyHealthIndicator implements HealthIndicator {
	private static final String VERSION = "v1.0.0";
	@Override
	public Health health() {
		int code = check();
		if (code!=0) {
			Health.down().withDetail("code",code).withDetail("version",VERSION).build();
		} 	
		return Health.up().withDetail("code",code).withDetail("version",VERSION).build();
	}
	private int check() {
		return 0;
	}
}
